/// @file Utilities.cpp
/// @brief provides central library of basic and routine funtions

#include "Utilities.h"

ngl::Vector Utilities::normaliseVector
                            (
                                const ngl::Vector _vector,
                                const ngl::Vector _zeroVector
                            )
{
    if (_vector.length() < 0.0001)
    {
        //zero vector
        return _zeroVector;
    }
    else
    {
        ngl::Vector r = _vector;
        r.normalize();
        return r;
    }
}

ngl::Vector Utilities::scaleVectorBy
                                (
                                    const ngl::Vector _vector,
                                    const float _scale,
                                    const ngl::Vector _zeroVector
                                )
{
    ngl::Vector tmp = Utilities::normaliseVector(_vector, _zeroVector);
    tmp = tmp * _scale;

    return tmp;
}
